<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/oublog/db" VERSION="20131028" COMMENT="XMLDB file for Moodle mod/oublog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
  <TABLES>
    <TABLE NAME="oublog" COMMENT="Blog activity instance">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="accesstoken" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="text format of intro field"/>
        <FIELD NAME="allowcomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 = do not allow comments 1 = allow comments from signed-in users 2 = allow comments from signed-in users, and moderated comments from external users"/>
        <FIELD NAME="maxbytes" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="512000" SEQUENCE="false"/>
        <FIELD NAME="maxattachments" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="9" SEQUENCE="false" COMMENT="Number of attachments allowed per post"/>
        <FIELD NAME="maxvisibility" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="100" SEQUENCE="false"/>
        <FIELD NAME="global" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Is this the global blog?"/>
        <FIELD NAME="views" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="completionposts" TYPE="int" LENGTH="9" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If set, specifies a number of blog posts that a student must make for this activity to be marked completed."/>
        <FIELD NAME="completioncomments" TYPE="int" LENGTH="9" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If set, specifies a number of blog comments that a student must make for this activity to be marked completed."/>
        <FIELD NAME="individual" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Is this the individual blog?"/>
        <FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="reportingemail" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Email addresses for reporting posts or comments"/>
        <FIELD NAME="displayname" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Alternative name used in some areas of the interface"/>
        <FIELD NAME="statblockon" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Show the stat block"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
        <INDEX NAME="global" UNIQUE="false" FIELDS="global"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="oublog_instances" COMMENT="Blog instance">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="oublogid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="summary" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="accesstoken" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="views" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="oublog_instances_oublog_fk" TYPE="foreign" FIELDS="oublogid" REFTABLE="oublog" REFFIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="oublog_posts" COMMENT="Blog posts">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="oubloginstancesid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
        <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="message" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="timeposted" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="allowcomments" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="0 = do not allow comments 1 = allow comments from signed-in users 2 = allow comments from signed-in users, and moderated comments from external users"/>
        <FIELD NAME="timeupdated" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="deletedby" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="timedeleted" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="visibility" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false"/>
        <FIELD NAME="lasteditedby" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="User ID of user to last edit post, or null if not edited"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="oublog_posts_oublog_instances_fk" TYPE="foreign" FIELDS="oubloginstancesid" REFTABLE="oublog_instances" REFFIELDS="id"/>
        <KEY NAME="oublog_posts_deletedby_users_fk" TYPE="foreign" FIELDS="deletedby" REFTABLE="user" REFFIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="timeposted" UNIQUE="false" FIELDS="timeposted"/>
        <INDEX NAME="timeupdated" UNIQUE="false" FIELDS="timeupdated"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="oublog_comments" COMMENT="Blog Comments">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="postid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="message" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="timeposted" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="deletedby" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="timedeleted" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="authorname" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="For moderated comments: author name (required). For non-moderated comments, must be null."/>
        <FIELD NAME="authorip" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="For moderated comments: author IP address (required). For non-moderated comments, must be null."/>
        <FIELD NAME="timeapproved" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="For moderated comments: time at which comment was approved. For non-moderated comments, must be null."/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="oublog_comments_oublog_post_fk" TYPE="foreign" FIELDS="postid" REFTABLE="oublog_posts" REFFIELDS="id"/>
        <KEY NAME="oublog_comments_userid_users_fk" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
        <KEY NAME="oublog_comments_deletedby_users_fk" TYPE="foreign" FIELDS="deletedby" REFTABLE="user" REFFIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="oublog_edits" COMMENT="Blog post edits">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="postid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="timeupdated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="oldtitle" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="oldmessage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="oublog_edits_oublog_posts_fk" TYPE="foreign" FIELDS="postid" REFTABLE="oublog_instances" REFFIELDS="id"/>
        <KEY NAME="oublog_edits_users_fk" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="oublog_tags" COMMENT="Blog tags">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="tag" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="oublog_taginstances" COMMENT="Blog tag instances">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="oubloginstancesid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="postid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="tagid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="oublog_taginstances_oublogs_blogs_fk" TYPE="foreign" FIELDS="oubloginstancesid" REFTABLE="oublog_instances" REFFIELDS="id"/>
        <KEY NAME="oublog_taginstances_oublog_posts_fk" TYPE="foreign" FIELDS="postid" REFTABLE="oublog_posts" REFFIELDS="id"/>
        <KEY NAME="oublog_taginstances_oublog_tags_fk" TYPE="foreign" FIELDS="tagid" REFTABLE="oublog_tags" REFFIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="oublog_links" COMMENT="Blog links">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="oublogid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="oubloginstancesid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
        <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="url" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
        <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="oublog_links_oublog_fk" TYPE="foreign" FIELDS="oublogid" REFTABLE="oublog" REFFIELDS="id"/>
        <KEY NAME="oublog_links_oublog_instances_fk" TYPE="foreign" FIELDS="oubloginstancesid" REFTABLE="oublog_instances" REFFIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="oublog_comments_moderated" COMMENT="Stores comments which are awaiting moderation or were recently moderated. (Comments are held in this table for 30 days even if they are approved or rejected, to make some calculation easier.)">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
        <FIELD NAME="postid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="ID of blog post which this is going to be a comment for (if approved)."/>
        <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Optional title of blog comment. (Blank if no title required.)"/>
        <FIELD NAME="message" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Text of blog comment"/>
        <FIELD NAME="timeposted" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Time at which comment was posted."/>
        <FIELD NAME="authorname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Name of author (required)."/>
        <FIELD NAME="authorip" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="IP address in string form."/>
        <FIELD NAME="approval" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Approval status: 0 = not confirmed, 1 = approved, 2 = rejected."/>
        <FIELD NAME="timeset" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The time (seconds since epoch) at which this comment was either approved or rejected. Initially null until rejection."/>
        <FIELD NAME="secretkey" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Field containing randomly-generated secret key which is used when approving posts via GET request (when session key is unavailable)."/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
        <KEY NAME="postid" TYPE="foreign" FIELDS="postid" REFTABLE="oublog_posts" REFFIELDS="id"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="authorip" UNIQUE="false" FIELDS="authorip"/>
      </INDEXES>
    </TABLE>
  </TABLES>
</XMLDB>
